<?php

namespace com\aristo\ingenieros\util;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

use \Exception;
use \mysqli;

/**
 * Description of Connection
 *
 * @author Gina
 */
class Connection extends Exception {
    
    private static $HOST = "localhost"; //'mysql.nixiweb.com';
    private static $USERNAME = "root";
    private static $CONTRASENHA = ""; //'inst3pedr02012'
    private static $DATABASE = "iespdsie_dbsyst3m";
    
    public static function getConnection() {
        try {
            $conn = new mysqli(Connection::$HOST, Connection::$USERNAME, Connection::$CONTRASENHA, Connection::$DATABASE); //, $port, $socket)
            if(mysqli_connect_errno()) {
                return NULL;
                // Error de $HOST: 2002
                // Error de $USERNAME: 1044
                // Error de $CONTRASENIA: 1045
                // Error de $DATABASE: 1049
            } else {
                return $conn;
            }
        } catch (Exception $exc) {
            return NULL; //echo $exc->getTraceAsString();
        }
    }
}